IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[spVehicleJob_InsertVehicleJob]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spVehicleJob_InsertVehicleJob]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Insert a Vehicle
-- =============================================
CREATE PROCEDURE [dbo].[spVehicleJob_InsertVehicleJob]
(
		@VehicleId	INT,
		@JobDate	DateTime,
		@Mechanic	Varchar(50),
		@Kms			Varchar(20),
		@StartTime	DateTime,
		@EndTime		DateTime,
		@Damages		Varchar(500),
		@WorkDone    Varchar(500)

)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON

	INSERT VehicleJob
	(
		VehicleId,
		JobDate,
		Mechanic,
		Kms,
		StartTime,
		EndTime,
		Damages,
		WorkDone,
		Active
	)
	VALUES
	(
		@VehicleId,
		@JobDate,
		@Mechanic,
		@Kms,
		@StartTime,
		@EndTime,
		@Damages,
		@WorkDone,
		1
	) 	

	SELECT @@IDENTITY 
	

 

END
GO
